package org.extframework.ld.content;

import java.util.HashMap;
import java.util.Map;

import org.extframework.ld.exception.WebException;

/**
 * @author : Dong.Li
 * @created : 2013-1-17
 * @version : 1.0
 * @description :
 */
public class ExtContent {
	private static Map<String, String> maintainPageMap = new HashMap<String, String>();

	private static Map<String, String> comBoxMap = new HashMap<String, String>();

	private static Map<String, String> detailPageMap = new HashMap<String, String>();

	private static Map<String, String> menuPageMap = new HashMap<String, String>();

	public static void addMenuPage(String menuId, String pageId)
			throws WebException {
		if (menuPageMap.containsKey(menuId)) {
			throw new WebException(menuId + ": MENU ID 已经存在!");
		}
		menuPageMap.put(menuId, pageId);
	}

	public static String getPageId(String menuId) {
		return ((String) menuPageMap.get(menuId));
	}

	public static void addDetailPage(String detailPageId, String rightId)
			throws WebException {
		if (detailPageMap.containsKey(detailPageId)) {
			throw new WebException(detailPageId + ": 明细页面ID已经存在!");
		}
		detailPageMap.put(detailPageId, rightId);
	}

	public static String getRightId(String detailPageId) {
		return ((String) detailPageMap.get(detailPageId));
	}

	public static void addcomBoxMap(String comboxId, String hql)
			throws WebException {
		if (detailPageMap.containsKey(comboxId)) {
			throw new WebException(comboxId + ": comboxId已经存在!");
		}
		detailPageMap.put(comboxId, hql);
	}

	public static String getcomBoxHql(String comboxId) {
		return ((String) detailPageMap.get(comboxId));
	}
}
